/**
 * 
 */
package org.iridium.allcomments.buzz;

import org.iridium.allcomments.common.Constants;
import org.iridium.allcomments.persistance.CommentsDAO;
import org.iridium.allcomments.persistance.CommentsDAOImpl;
import org.iridium.allcomments.persistance.UserInfoDAO;
import org.iridium.allcomments.persistance.UserInfoDAOImpl;
import org.iridium.allcomments.persistance.UserTagDAO;
import org.iridium.allcomments.persistance.UserTagDAOImpl;

/**
 * @author iridium
 * 
 */
public class AdminBuzz {
	/**
	 * To remove one user of the system, but leave his comments
	 * 
	 * @param userId
	 */
	public void removeUser(long userId) {
		UserInfoDAO dao = new UserInfoDAOImpl();
		dao.delItem(userId);
	}

	/**
	 * Remove one user, if delMsg = true, remove his comments and tags as well,
	 * or leave them.
	 * 
	 * @param userId
	 * @param delMsg
	 */
	public void removeUser(long userId, boolean delMsg) {
		CommentsDAO comment = new CommentsDAOImpl();
		comment.delItemFromOne(userId);

		UserTagDAO tag = new UserTagDAOImpl();
		tag.deleteTag(userId);

		this.removeUser(userId);
	}

	/**
	 * To block a user
	 * 
	 * @param userId
	 */
	public void blockUser(long userId) {
		UserInfoDAO userM = new UserInfoDAOImpl();
		userM.updateRoleId(userId, Constants.USER_ROLE_BLOCK);
	}

}
